import request from '@/utils/request'
import { api } from '~/ui-domain'

/**
 * 获取报价单列表
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function getQuotations(params) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/quotations`,
    method: 'get',
    loading: false,
    params
  })
}

/**
 * 添加报价单
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function addQuotations(params) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/quotations`,
    method: 'post',
    data: params
  })
}

/**
 * 获取报价单详情
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function getQuotationsDetail(id) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/quotations/${id}`,
    method: 'get'
  })
}

/**
 * 修改报价单
 * @param id
 * @param params
 * @returns {Promise | Promise<unknown>}
 */
export function updateQuotations(id, params) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/quotations/${id}`,
    method: 'put',
    data: params
  })
}

/**
 * 删除报价单
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function deleteQuotations(id) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/quotations/${id}`,
    method: 'delete'
  })
}

/**
 * 获取采购单详情
 * @param id
 * @returns {Promise | Promise<unknown>}
 */
export function getPurchaseDetail(id) {
  return request({
    url: `${api.b2b}/seller/b2b/purchase/orders/${id}`,
    method: 'get'
  })
}
